<?php if(!IS_AJAX){?>
<include file="Public:header" />
<style>
.selectlist { margin: 0; padding: 0; }
.selectlist li { list-style-type: none; margin: 0; padding: 0; padding: 5px; border-bottom: 1px solid #eee; margin: 0 8px; }
.selectlist li:hover { background: #eee; }
.selectlist li>ul>li:hover { background: #E7E7E7; }
.table th{border-bottom: none!important;}
.table td{vertical-align: middle!important;}
.directory-info-row{ margin-top:0;}
</style>
<div class="row">
    <div class="col-sm-12" id="ListDataBox">
        <div class="panel modal-open "  data-step="4" data-intro="此处查看积分详情" data-position="left">
            <div class="panel-heading">
                <span class="pagetitle">奖扣分事件</span>
            </div>
            <div class="panel-body">
            <form action="<?php echo U('index');?>" id="ajaxlistboxform" method="post" style="padding-bottom:15px;">
                <input type="hidden" name="order"/>
                <input type="hidden" name="pagesize" value="10" />
                <input type="hidden" name="order_type"/>
                
                <?php if($memberInfo['isadministrator']||in_array($this->memberInfo['id'],getManagerList())){ ?>
                
                <?php }else if(getAccessMenu($accessList, 'Intesys', 'Integral_log', 'change')){ ?>
                	<input type="hidden" name="pos_id" value="<?php echo(trim($memberInfo['memberpositionid'],',')); ?>">
                <?php }else{ ?>
                	<input type="hidden" name="member_id" value="<?php echo $memberInfo['id']; ?>">
                <?php } ?>
                <input type ="hidden" name="formtype" value="">
                	<if condition="getAccessMenu($accessList, 'Intesys', 'Integral_log', 'change')">
                    <html:dropdownselect class=" pull-left    memberselect  " listloaded="" selected="" name="member" style="height:auto; width:120px; display:inline-block; line-height:32px; margin-right:10px;" multi="0" action="{:U('Team/membergroup')}" title="选择员工" placeholder="点击选择人员" />
                    </if>
                    <html:dropdownselect class="typeselect pull-left" selected="" name="formtype" style="height:auto; width:120px; display:inline-block; line-height:32px; margin-right:10px;" multi="0" action="{:U('Team/form')}" title="选择规则"  placeholder="点击选择类型"  listloaded="" /><if condition="count($integraltypelist) gt 1">
            <select class="form-control pull-left" onChange="$('#ajaxlistboxform').submit();" name="type_id" style="display:inline; width:auto; margin-right:10px;">
                <option value="">积分类型</option>
            <volist name="integraltypelist" id="vo">
                <option value="{$vo.id}">{$vo.remark}</option>
            </volist>
            </select> 
                                <else/>
                                    <input type="hidden" name="type_id" value="{$integraltypelist.0.id}">
                                </if>
                                <div style="display:inline-block; width:180px;" class="pull-left"><div class="input-group">
                                    <input type="text" name="keywords" class="form-control" placeholder="搜索关键词">
                                      <span class="input-group-btn">
                                        <button type="button" onClick="$('#ajaxlistboxform').submit();" class="btn btn-default"><i class="fa icon-search"></i></button>
                                      </span>
                                </div></div>
                                
                                
                                
                                
                                
            <if condition="getAccessMenu($accessList, 'Intesys', 'Integral_log', 'change')">
               <a  href="javascript:void(0);" onClick="_openWindow('<?php echo U('change'); ?>',800,'积分事件录入','提交',function() { $('#ajaxlistboxform').submit(); },'')" class="btn btn-success pull-right">积分事件录入</a>
            </if>    
                                
                                
                                
                                 
                                
                                
                                
                   <div class="clearfix"></div>
            </form>
                <table class="display table table-bordered table-striped ">
                    <thead>
                        <tr>
                            <th>工号</th>
                            <th>名字</th>
                            <th class="hidden-sm hidden-xs sortable" data-order="time" style="cursor:pointer;">时间 <i class="fa icon-sort"></i></th>
                            <th class="hidden-xs">部门</th>
                            <th class="visible-lg">事件</th>
                            <th style="width:60px">类型</th>
                            <th class="sortable" data-order="changenum" style="width:80px;cursor:pointer;">积分 <i class="fa icon-sort"></i></th>
                            <!--<th class="hidden-xs">类型</th>-->
                            <th class="hidden-sm hidden-xs">审核人</th>
                            <if condition="getAccessMenu($accessList, 'Intesys', 'Integral_log', 'update')">
                            	<th style="text-align: center;">操作</th>
                            </if>
                        </tr>
                    </thead>
                    <tbody class="" id="ajaxlistbox" style="color:#666;">
                        <?php }?>
                        <?php if(IS_AJAX){?>
                        <empty name="list">
                        <tr>
                            <td colspan="9"><div style="padding:10px; text-align:center;">暂无奖扣分事件</div></td>
                        </tr>
                        <else/>
                        <volist name="list" id="vo" key="i">
                            <tr class="DataListItem DataListItembg item{$vo.id}">
                                <td class="">{$vo.member_id}</td>
                                <td class="straight">{$vo.membername}</td>
                                <td class="hidden-sm hidden-xs straight">{:date('Y-m-d',$vo['time'])}</td>
                                <td class="hidden-xs">
                                	<div title="{$vo.memberpositionname}" class="text-elli">{$vo.memberpositionname}</div>
                                </td>
                                <td class="visible-lg">{:str_replace(["\r\n","\n"],' ',$vo['remark'])} </td>
                                <td>{$vo.integralname}</td>
                                    <td class="<?= (int)$vo['changenum']>0?'':'text-danger'  ?>" style="position:relative;" 
                                <if condition="$i eq 1"> data-step="5" data-intro="此处悬停鼠标,查看获得积分的原因和规则来源" data-position="left"
                                </if>
                                >
                                <div class="bubble" style="cursor:pointer">
                                    {$vo.changenum}
                                </div>
                                    </td>
                                <td class="hidden-sm hidden-xs">
                                	<div title="{$vo.approvername}" class="text-elli">{$vo.approvername}</div>
                                </td>
                                <if condition="getAccessMenu($accessList, 'Intesys', 'Integral_log', 'update')">
                                <td style="text-align:center;">
                                    <a class="btn btn-success" onClick="_openWindow('<?php echo U('edit',['id'=>$vo['id']]); ?>',600,'积分事件修改','保存',function() { $('#ajaxlistboxform').submit();return true; },'')">
                                    	修改事件
                                    </a>
                                </td>
                                </if>
                            </tr>
                        </volist>
                        </empty>
                        <?php }?>
                        <?php if(!IS_AJAX){?>
                    </tbody>
                </table>
                <div class="PagesBox" id="ajaxlistboxpages" style="text-align:center"></div>
            </div>
        </div>
    </div>


    <div class="clearfix">
    </div>
</div>
<include file="Public:script" />

<script type="text/javascript">
$('#ajaxlistbox').ajaxlist({loading:'<tr><td colspan="9"><div class="lockwindowlayout" id="lockwindowlayout" style="overflow:hidden; padding:10px 0;"><div class="loader-inner line-scale" style="text-align:center;"><div></div><div></div><div></div><div></div><div></div></div><style>.lockwindowlayout .line-scale{height:20px;}.lockwindowlayout .line-scale div{background:#5ec8ff; height:20px;}</style></div></td></tr>'});
//表格排序
$(".sortable").click(function(e) {
	var order=$(this).find('.icon-sort-asc').length;
	$(".sortable i").removeAttr('class').addClass('fa icon-sort');
	if(order){
		$(this).find('i').addClass('icon-sort-desc');
		$("#ajaxlistboxform input[name='order_type']").val('desc');
	}else{
		$(this).find('i').addClass('icon-sort-asc');
		$("#ajaxlistboxform input[name='order_type']").val('asc');
	}
    $("#ajaxlistboxform input[name='order']").val($(this).attr('data-order'));
	$('#ajaxlistboxform').submit();
});


$(document).ready(function(){
	$('.icheck input').change(function(e) {
		$('#ajaxlistboxform').submit();
	});
});
$('#starttime').datepicker();
$('#starttime').change(function(){
	$('#ajaxlistboxform').submit();
});
$('#endtime').datepicker();
$('#endtime').change(function(){
	$('#ajaxlistboxform').submit();
});

$('.memberselect .selectitem').click(function(){
	if($(this).prev('em').length!=0){
		$(this).find('input').eq(0).attr('name','pos_name');
		$(this).find('input').eq(1).attr('name','pos_id');
	}
});
$('.memberselect').blur(function(){
	
        $('.memberselect .member_positionline input').eq(0).attr('name','pos_name');
	    $('.memberselect .member_positionline input').eq(1).attr('name','pos_id');
	
	
	
	$('#ajaxlistboxform').submit();
});
$('.typeselect').blur(function(e) {
		$("#ajaxlistboxform input[name='formtype']").remove();
		if($('.typeselect .itemspan').children('input:eq(1)').length!=0) {
			$('#ajaxlistboxform').append("<input type='hidden' name='formtype' value='" + $('.typeselect .itemspan').children("input:eq(1)").attr('value') + "'>");
		}
		$('#ajaxlistboxform').submit();
	});

//点击‘X’清除赋值并提交表单
$('.itemspan a').click(function(){
	$("#ajaxlistboxform input[name='member_id']").val('');
	$('#ajaxlistboxform').submit();
});

</script>
</body></html><?php }?>